<template>
  <div class="search">
    <tabbar>
      <div slot="left"></div>
      <div slot="center">搜索</div>
    </tabbar>
    <div class="commit">
      <input type="text" v-model="value" placeholder="请输入商家或美食名称" />
      <div @click="searchlist">提交</div>
    </div>
    <div class="history" v-if="inputed">
      <div>搜索历史</div>
    </div>
    <div class="list" v-else>
      <div v-if="hasdata">
        <div v-for></div>
      </div>
      <div v-else>抱歉！无搜索结果</div>
    </div>
  </div>
</template>

<script>
import tabbar from "../../components/tabbar.vue";
import http from "../../network/request";
export default {
  data() {
    return {
      inputed: true,
      hasdata: false,
      value: "",
      shoplist: [],
    };
  },
  components: {
    tabbar,
  },
  methods: {
    searchlist() {
      this.inputed = false;
      http({
        url: `/v4/restaurants?geohash=31.22967,121.4762&keyword=肯德基`,
      }).then((res) => {
        console.log(res);
        this.shoplist = res.data;
      });
      if (this.shoplist) {
        this.hasdata = true;
      }
    },
  },
};
</script>

<style>
</style>